package com.aiyige.page.coupon.model;

import android.os.Parcel;
import android.os.Parcelable;

public class UserCoupon implements Parcelable {
    String id;
    String userId;
    String couponId;
    String couponName;
    String couponType;
    Double couponAmount;
    Double fullAmount;
    String scope;
    Long useableStartTime;
    Long useableEndTime;
    String status;
    String receivedStatus;
    Long createTime;
    Long useTime;
    String scopeDesc;// 用券范围描述
    String currentMomentAvailable;
    String currentMomentAvailableDesc;
    boolean selected;


    public UserCoupon() {
    }

    public UserCoupon(UserCoupon other) {
        this.id = other.id == null ? "" : other.id;
        this.userId = other.userId == null ? "" : other.userId;
        this.couponId = other.couponId == null ? "" : other.couponId;
        this.couponName = other.couponName == null ? "" : other.couponName;
        this.couponType = other.couponType == null ? "" : other.couponType;
        this.couponAmount = other.couponAmount == null ? 0 : other.couponAmount;
        this.fullAmount = other.fullAmount == null ? 0 : other.fullAmount;
        this.scope = other.scope == null ? "" : other.scope;
        this.useableStartTime = other.useableStartTime == null ? 0 : other.useableStartTime;
        this.useableEndTime = other.useableEndTime == null ? 0 : other.useableEndTime;
        this.createTime = other.createTime == null ? 0 : other.createTime;
        this.status = other.status == null ? "" : other.status;
        this.useTime = other.userId == null ? 0 : other.useTime;
        this.scopeDesc = other.scopeDesc == null ? "" : other.scopeDesc;
        this.currentMomentAvailable = other.currentMomentAvailable == null ? "" : other.currentMomentAvailable;
        this.currentMomentAvailableDesc = other.currentMomentAvailableDesc == null ? "" : other.currentMomentAvailableDesc;
        this.selected = other.selected;
        this.receivedStatus = other.receivedStatus == null ? "" : other.receivedStatus;

    }

    private UserCoupon(Builder builder) {
        id = builder.id;
        userId = builder.userId;
        couponId = builder.couponId;
        couponName = builder.couponName;
        couponType = builder.couponType;
        couponAmount = builder.couponAmount;
        fullAmount = builder.fullAmount;
        scope = builder.scope;
        useableStartTime = builder.useableStartTime;
        useableEndTime = builder.useableEndTime;
        status = builder.status;
        receivedStatus = builder.receivedStatus;
        createTime = builder.createTime;
        useTime = builder.useTime;
        scopeDesc = builder.scopeDesc;
        currentMomentAvailable = builder.currentMomentAvailable;
        currentMomentAvailableDesc = builder.currentMomentAvailableDesc;
        selected = builder.selected;
    }

    public static Builder newBuilder() {
        return new Builder();
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.userId);
        dest.writeString(this.couponId);
        dest.writeString(this.couponName);
        dest.writeString(this.couponType);
        dest.writeValue(this.couponAmount);
        dest.writeValue(this.fullAmount);
        dest.writeString(this.scope);
        dest.writeValue(this.useableStartTime);
        dest.writeValue(this.useableEndTime);
        dest.writeString(this.status);
        dest.writeString(this.receivedStatus);
        dest.writeValue(this.createTime);
        dest.writeValue(this.useTime);
        dest.writeString(this.scopeDesc);
        dest.writeString(this.currentMomentAvailable);
        dest.writeString(this.currentMomentAvailableDesc);
        dest.writeByte(this.selected ? (byte) 1 : (byte) 0);
    }

    protected UserCoupon(Parcel in) {
        this.id = in.readString();
        this.userId = in.readString();
        this.couponId = in.readString();
        this.couponName = in.readString();
        this.couponType = in.readString();
        this.couponAmount = (Double) in.readValue(Double.class.getClassLoader());
        this.fullAmount = (Double) in.readValue(Double.class.getClassLoader());
        this.scope = in.readString();
        this.useableStartTime = (Long) in.readValue(Long.class.getClassLoader());
        this.useableEndTime = (Long) in.readValue(Long.class.getClassLoader());
        this.status = in.readString();
        this.receivedStatus = in.readString();
        this.createTime = (Long) in.readValue(Long.class.getClassLoader());
        this.useTime = (Long) in.readValue(Long.class.getClassLoader());
        this.scopeDesc = in.readString();
        this.currentMomentAvailable = in.readString();
        this.currentMomentAvailableDesc = in.readString();
        this.selected = in.readByte() != 0;
    }

    public static final Creator<UserCoupon> CREATOR = new Creator<UserCoupon>() {
        @Override
        public UserCoupon createFromParcel(Parcel source) {
            return new UserCoupon(source);
        }

        @Override
        public UserCoupon[] newArray(int size) {
            return new UserCoupon[size];
        }
    };

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getCouponId() {
        return couponId;
    }

    public void setCouponId(String couponId) {
        this.couponId = couponId;
    }

    public String getCouponName() {
        return couponName;
    }

    public void setCouponName(String couponName) {
        this.couponName = couponName;
    }

    public String getCouponType() {
        return couponType;
    }

    public void setCouponType(String couponType) {
        this.couponType = couponType;
    }

    public Double getCouponAmount() {
        return couponAmount;
    }

    public void setCouponAmount(Double couponAmount) {
        this.couponAmount = couponAmount;
    }

    public Double getFullAmount() {
        return fullAmount;
    }

    public void setFullAmount(Double fullAmount) {
        this.fullAmount = fullAmount;
    }

    public String getScope() {
        return scope;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public Long getUseableStartTime() {
        return useableStartTime;
    }

    public void setUseableStartTime(Long useableStartTime) {
        this.useableStartTime = useableStartTime;
    }

    public Long getUseableEndTime() {
        return useableEndTime;
    }

    public void setUseableEndTime(Long useableEndTime) {
        this.useableEndTime = useableEndTime;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getReceivedStatus() {
        return receivedStatus;
    }

    public void setReceivedStatus(String receivedStatus) {
        this.receivedStatus = receivedStatus;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public Long getUseTime() {
        return useTime;
    }

    public void setUseTime(Long useTime) {
        this.useTime = useTime;
    }

    public String getScopeDesc() {
        return scopeDesc;
    }

    public void setScopeDesc(String scopeDesc) {
        this.scopeDesc = scopeDesc;
    }

    public String getCurrentMomentAvailable() {
        return currentMomentAvailable;
    }

    public void setCurrentMomentAvailable(String currentMomentAvailable) {
        this.currentMomentAvailable = currentMomentAvailable;
    }

    public String getCurrentMomentAvailableDesc() {
        return currentMomentAvailableDesc;
    }

    public void setCurrentMomentAvailableDesc(String currentMomentAvailableDesc) {
        this.currentMomentAvailableDesc = currentMomentAvailableDesc;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public static final class Builder {
        private String id;
        private String userId;
        private String couponId;
        private String couponName;
        private String couponType;
        private Double couponAmount;
        private Double fullAmount;
        private String scope;
        private Long useableStartTime;
        private Long useableEndTime;
        private String status;
        private String receivedStatus;
        private Long createTime;
        private Long useTime;
        private String scopeDesc;
        private String currentMomentAvailable;
        private String currentMomentAvailableDesc;
        private boolean selected;

        private Builder() {
        }

        public Builder id(String val) {
            id = val;
            return this;
        }

        public Builder userId(String val) {
            userId = val;
            return this;
        }

        public Builder couponId(String val) {
            couponId = val;
            return this;
        }

        public Builder couponName(String val) {
            couponName = val;
            return this;
        }

        public Builder couponType(String val) {
            couponType = val;
            return this;
        }

        public Builder couponAmount(Double val) {
            couponAmount = val;
            return this;
        }

        public Builder fullAmount(Double val) {
            fullAmount = val;
            return this;
        }

        public Builder scope(String val) {
            scope = val;
            return this;
        }

        public Builder useableStartTime(Long val) {
            useableStartTime = val;
            return this;
        }

        public Builder useableEndTime(Long val) {
            useableEndTime = val;
            return this;
        }

        public Builder status(String val) {
            status = val;
            return this;
        }

        public Builder receivedStatus(String val) {
            receivedStatus = val;
            return this;
        }

        public Builder createTime(Long val) {
            createTime = val;
            return this;
        }

        public Builder useTime(Long val) {
            useTime = val;
            return this;
        }

        public Builder scopeDesc(String val) {
            scopeDesc = val;
            return this;
        }

        public Builder currentMomentAvailable(String val) {
            currentMomentAvailable = val;
            return this;
        }

        public Builder currentMomentAvailableDesc(String val) {
            currentMomentAvailableDesc = val;
            return this;
        }

        public Builder selected(boolean val) {
            selected = val;
            return this;
        }

        public UserCoupon build() {
            return new UserCoupon(this);
        }
    }
}
